<html>

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<title>{:C('sitename')}</title>
		<meta name="format-detection" content="telephone=no,email=no"/>
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0">
		<link href="__PUBLIC__/Admin/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
		<link href="__PUBLIC__/Admin/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">

		<link href="__PUBLIC__/Admin/css/animate.min.css" rel="stylesheet">
		<link href="__PUBLIC__/Admin/css/style.min862f.css?v=4.1.0" rel="stylesheet">
	</head>
	<style type="text/css">
		body,
		canvas,
		div {
			-moz-user-select: none;
			-webkit-user-select: none;
			-ms-user-select: none;
			-khtml-user-select: none;
			-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
		}
		.facesj{
			display: inline-block;
			background-color: #1fa1dc;
			width: 60px;
		    height: 32px;
		    line-height: 32px;
		    border-radius: 3px;
		    text-align: center;
		    font-size: 14px;
		    margin-top:6px;
		    border: 1px solid #1fa1dc;
		    color: #FFF;
		    margin-left:10px;
		}
		.form-control{width:70%;display: inline-block;}
	</style>
	<body>
		<div class="middle-box text-center loginscreen  animated fadeInDown">
			<div>
				<div>
					<h1 style="height:60px"></h1>
				</div>
				<h3>绑定用户(可用户网页登录)</h3>
				<h6>默认绑定的帐号为用户号，密码默认123456，可用这个登录其他的手机浏览器，支付宝，PC端等等</h6>
				<form class="m-t" role="form" method="post" action="{:U('Home/Index/bind_action')}" id="LoginForm">
				<div class="form-group">
					<label class="control-label">昵称：</label>
					<input type="text" id="nickname" name="nickname" value="{$user.nickname}" class="form-control" placeholder="昵称" readonly="">
				</div>
				<div class="form-group">
					<label class="control-label">帐号：</label>
					<input type="text" id="username" name="username" value="{$user.username}" class="form-control" placeholder="帐号" readonly>
				</div>
				<div class="form-group">
					<label class="control-label">密码：</label>
					<input type="password" id="password" name="password" class="form-control" placeholder="密码(最好含有大小写和数字)" required>
				</div>
				<div class="form-group">
					<label class="control-label">重复密码：</label>
					<input type="password" id="repassword" name="" class="form-control" placeholder="重复密码" required>
				</div>
				<input type="hidden" name="id" value="{$user.id}">
				<button type="submit" class="btn btn-success block full-width m-b">确  定</button>
			</form>
			</div>
		</div>

		<script src="__PUBLIC__/Admin/js/jquery.min.js?v=2.1.4"></script>
		<script src="__PUBLIC__/Admin/js/bootstrap.min.js?v=3.3.6"></script>
		
		<script src="__PUBLIC__/Common/js/ajaxForm.js"></script>
		<script src="__PUBLIC__/layer/layer.js"></script>
		<script type="text/javascript">
			

			$(function(){
				$('#LoginForm').ajaxForm({
					beforeSubmit: checkForm,
					success: complete, 
					dataType: 'json'
				});
				function CheckStr(str){
		           var myReg = "[@/'\"#!$%&^*]+";
		             var reg = new RegExp(myReg);
		            if(reg.test(str)){
		            	return true; 
	            	} else {
	            		 return false; 
	            	}
		        }
				function checkForm(){
					if( '' == $.trim($('#username').val())){
						layer.alert('用户名不能为空', {icon: 5}, function(index){
			 			layer.close(index);
						$('#username').focus(); 
						});
						return false;
					}
					if (CheckStr($('#username').val())) {
						layer.alert('用户名不能有特殊字符', {icon: 5}, function(index){
			 			layer.close(index);
						$('#username').focus(); 
						});
						return false;
					}

					if ($('#password').val().length < 6) {
						layer.alert('密码长度不能低于6位', {icon: 5}, function(index){
			 			layer.close(index);
						$('#password').focus(); 
						});
						return false;
					}

					if( '' == $.trim($('#password').val())){
						layer.alert('密码不能为空', {icon: 5}, function(index){
			 			layer.close(index);
						$('#password').focus(); 
						});
						return false;
					}

					if ($('#password').val() != $('#repassword').val()) {
						layer.alert('两次输入的密码不一致', {icon: 5}, function(index){
			 			layer.close(index);
						$('#password').focus(); 
						});
						return false;
					}
				}
				function complete(data){
					if(data.status==1){
						$('.btn').attr('disabled','disabled');
						layer.msg(data.info, function(index){
			 				layer.close(index);
							window.location.href=data.url;
						});
					}else{
						layer.msg(data.info);
						$('#password').val('').focus();
						return false;	
					}
				}
			});
		</script>
		</script>
		<script src="__PUBLIC__/Home/js/cls.js"></script>
	</body>

</html>